package com.example.dzdph.service.ui

import com.example.dzdph.filter.Filter
import java.util.LinkedList

open class Selector : Filter {
    val filters = LinkedList<Filter>()

    override fun filter(node: UiObject) = filters.all { it.filter(node) }

    fun add(filter: Filter) = filters.add(filter)

    fun append(uiSelector: UiSelect) = filters.addAll(uiSelector.selector.filters)

    override fun toString() = filters.joinToString(".").ifEmpty { "selector()" }
}